'use strict';

var Router = require('koa-router');
var router = new Router({
    //prefix: '/api'
});

var realtimeCapitalFlow = require('../cron/realtime_capital_flow');

router.get('/realtimecapitalflow', function (ctx, next) {
    ctx.type = 'application/json';
    return realtimeCapitalFlow().then(function (result) {
        ctx.body = result.data;
    }, function (err) {
        console.log(err);
        ctx.body = { error: err };
    });
});

module.exports = router;